In the context of computer systems, software and languages, the software objects for a running software program are generally stored in an area of the system memory where they can be readily accessed. Some languages, such as C and C++, utilize manual memory allocation, which requires that the memory occupied by software objects be manually allocated and deallocated as needed. Other languages, such as Java and C#, utilize dynamic memory allocation, wherein a garbage collector periodically attempts to reclaim any memory occupied by software objects that are no longer in use by running programs—a process referred to as garbage collection.
In garbage collected languages, the area of memory to be garbage collected is generally referred to as the heap. Garbage collection frees the software developer from having to manually account for memory deallocation. Some computer languages that do not include garbage collection as part of their language specification do utilize it for practical or efficiency reasons (e.g., formal languages such as lambda calculus); while other computer languages (e.g., C, C++) that were originally designed to utilize manual memory management, now also provide garbage-collected implementations.
In many environments, the system includes a virtual machine upon which the software program will run. In Java, the virtual machine is referred to as a Java Virtual Machine (JVM), which allows for portability of software applications between different underlying computer architectures, including different computer hardware platforms and/or operating systems, inasmuch as the JVM allows a compiled Java program to be run on the JVM independently of whatever hardware or operating system may be used underneath. Examples of available JVMs include the Oracle JRockit and Hotspot products. Each JVM includes a garbage collector component that handles the garbage collection process for that JVM.
However, a problem with many JVM implementations is that the JVM heap generally must be sized precisely at startup; and once specified, the heap settings cannot be altered at runtime. This limitation can result in a software program at runtime using up all of the allocated memory, ultimately culminating in an out-of-memory error (e.g., OutOfMemoryError). This is the general area that embodiments of the invention are intended to address.